<template>
	
	<view class="asset">
		<view class="head" style="z-index: 999;">
			<view class="head_text" @click="black()">返回</view>
			<image src="../../../static/public/img/fh.png"
				style="width: 18px;height: 18px;position: absolute;top:33px;left: 15px;"></image>
				<view class="ss">修改取款密码</view>
		</view>
		
		<view style="width: 100%;height: 30px;line-height: 30px;background: white;font-size: 12px;padding: 3%;border-bottom: 1px solid #d9d9d9;" >
			<view style="float: left;width: 20%;">输入原密码</view>
			<input type="passw" value="" placeholder="请输入原来的密码" v-model="password" style="font-size: 12px;height: 30px;line-height: 30px;width:65%;float: left;" />
			<!-- <image src="../../../static/public/img/show.png" style="width: 15px;height: 10px;float:left;margin-top: 3%;float: left;"></image> -->
		</view>
		<view style="width: 100%;height: 30px;line-height: 30px;background: white;font-size: 12px;padding: 3%;">
			<view style="float: left;width: 20%;">输入新密码</view>
			<input type="passw" value="" placeholder="6位数字或字母组合" v-model="new_password"  style="font-size: 12px;height: 30px;line-height: 30px;width:65%;float: left;" />
			<!-- <image src="../../../static/public/img/show.png" style="width: 15px;height: 10px;float:left;margin-top: 3%;float: left;"></image> -->
		</view>
		
		<view style="width:100%;text-align: center;font-size: 12px;color: #999;margin-top: 10%;">旧密码如输错3次将冻结账号，请联系在线客服解冻。</view>
		<button style="font-size: 14px;background-image: linear-gradient(180deg,#e6b87a,#d49a53 80%);color: #1c1c1e;width:94%;margin-left: 3%;margin-top:5%;height: 45px;line-height: 45px;" @click="button">确认修改</button>
	
			
	

	</view>
</template>

<script>
	//导入组件
	export default {
		data() {
			return {
				password:'',
				new_password:''
			}
		},
		methods: {
			   black(){
				   uni.navigateBack()
			   },
			   button(){
				   if(this.password == '' || this.password == null || !this.password){
					   return this.$api.msg('请输入原密码');
				   }
				   if(this.new_password == '' || this.new_password == null || !this.new_password){
					   return this.$api.msg('请输入新密码');
				   }
				   if(this.new_password.length != 6)
				   {
					   return this.$api.msg('请输入6位数字或字母组合');
				   }
				   this.$api.request('/api/updatePayPwd',{password:this.password,new_password:this.new_password}).then((res)=>{
					   if(res.code != 200){
							return this.$api.msg(res.message);
					   }
					   if(res.code == 200)
					   {
						   uni.showModal({
							title: '提示',
							content: '取款密码修改成功',
							showCancel:false,
							success: function (res) {
								if (res.confirm) {
									// console.log('用户点击确定');
									uni.navigateBack()
								}
							}
						   });
					   }
				   })
			   				   
			   }
		},
		onShow() { 

		},

	}
</script>

<style lang="scss">
	page {
		background-color:#f2f2f2;
	}

	.asset {
	   .head {
	   	background: #151516 !important;
	   	color: #fff;
	   	height: 130rpx;
	   	font-size: 18px;
	   }
	   
	   .head_text {
		 font-size: 14px;
         margin-left: 9%;
	   	 line-height: 160rpx;
	   }
	   .item{
		   width: 100%;
		   float: left;
		   margin-top: 5%;
		   border-bottom: 1px solid #ddd;
		   padding-bottom: 3%;
	   }
	 
	   .ss {
	   		 text-align: center;
	   		 line-height: 160rpx;
	   		 position: absolute;
	   		 top: 0px;
	   		 left: 37%;
	   }

	}
</style>
